SWAGOLX.EXE (c) 1993 GDSOFT ALL RIGHTS RESERVED 00006 1 08-24-9413:19ALL STEVE ROGERS Recursing ALL Dirs SWAG9408 O)╠5 6 ª╢ π uses dos;π procedure ProcessAllFiles(dir : dirstr);π varπ d : searchrec;ππ beginπ while (dir[length(dir)] = '\') do dec(dir[0]);ππ { this gets the files }π findfirst(dir+'\*.*',anyfile+hidden+system+readonly,d);π while (doserror = 0) do beginπ process(d.name);π findnext(d);π end;ππ { this gets the subs, recursively }π findfirst(dir+'\*.*',directory,d);π while (doserror = 0) do beginπ if (d.attr and directory = directory) thenπ ProcessAllFiles(dir+'\'+d.name);π findnext(d);π end;ππ end;π 2 08-24-9413:31ALL DAVE JARVIS Recursive Directory SWAG9408 ¿=7⌐ 11 ª╢ {π On 05-25-94 ROBERT HARRISON wrote to ALL...ππ RH> I'm trying to obtain the source for searching for files in allπ RH> directories and drives. Anyone happened to have the informationπ RH> they would like to share with me? Thanks.ππ----------------- 8< ------------- }ππUSES DOS, Crt;ππPROCEDURE Search;πVARπ Err : INTEGER;π Attrib,π CurrDir : STRING;π DirInfo : SearchRec;ππBeginπ FindFirst( '*.*', AnyFile, DirInfo );ππ Err := 0;ππ WHILE Err = 0 DOπ Beginπ { If the directory wasn't . or .., then find all files in it ... }π IF ((DirInfo.Attr AND Directory) = Directory) ANDπ (Pos( '.', DirInfo.Name ) = 0) THENπ Beginπ {$I-}π ChDir( DirInfo.Name );π {$I+}ππ { Find all files in subdirectory that was found }π Search;π DirInfo.Attr := 0;π Endπ ELSEπ Beginπ GetDir( 0, CurrDir );π WriteLn( DirInfo.Name );π FindNext( DirInfo );ππ Err := DosError;π End;π End;ππ {$I-}π ChDir( '..' );π {$I+}ππ IF IOResult <> 0 THENπ { Do Nothing...probably root directory... };πEnd;ππVARπ CurDir : STRING;ππBeginπ ClrScr;π GetDir( 0, CurDir );π ChDir( 'C:\' );π Search;π ChDir( CurDir );πEnd.π 3 08-24-9413:40ALL PHIL OVERMAN GIF Directory SWAG9408 dïmJ 122 ª╢ Program GIFDIR(Input, Output);ππUses Dos, Crt;ππConstπ ProSoft = ' Gif DIRectory - Version 2.0 (C) ProSoft '+Chr(254)+' Phil R. Overman 02-02-92';π gifliteheader = chr($21)+chr($FF)+chr(11)+'GIFLITE';π giflitesearch = 100;π ScreenLines = 23;π Maxlinelength = 80;π test0 = false;π test1 = true;π(*π {$I-}π*)πTypeπ String12 = String[12];π LineType = Packed Array[1..Maxlinelength] of char;π LengthType = 0..Maxlinelength;π String2 = String[2];π String3 = String[3];π String8 = Packed Array[1..8] of char;π{ String12 = Packed Array[1..12] of char; }π String15 = String[15];ππVarπ dodate, dotime, domegs, doextension : boolean;π doversion, dopalette, doGCT : boolean;π dofiledot, doall, dogiflite : boolean;π CmtFound, Pause, ShowZips, isgif : Boolean;π CmtSize, FileCount, LinesWritten : Word;π attr, height, width, colors : Word;π fileattr : word;π TotalSize, position : Longint;π filesize, filedate : longint;π icount, jcount : integer;π count, clen : Byte;π megs : real;π DirInfo, gifdirinfo : Searchrec;π Path, Gifpath, filein : PathStr;π Dir : DirStr;π Name, infdatestring, gifname : NameStr;π Ext : ExtStr;π A, B, C, cc, ch, eoname : Char;π Abyte : Byte;π cs : String[1];π meg : String2;π gversion, gheader : String3;π filename : String[12];π infile, outfile : text;π giffile : file;π infdt, filedt : datetime;π giffilein : String15;π Drive : String2;π GCTF {1 Bit} : boolean;π ColorResolution {3 Bits} : byte;π SortFlag {1 Bit} : boolean;π SizeOfGCT {3 Bits} : byte;π giflite : boolean;π BackgroundColorIndex : Byte;π PixelAspectRatio : Byte;π SizeofPalette : Longint;π{ Cmt : CmtType; }π(***************************************************************)πProcedure BadParms;πbeginπ writeln(' Program syntax: GDIR [d:\Path][Filename[.GIF]] [/p/a/d/t/m/f/v/g/r/?|h]');π{ writeln; }π writeln(' Displays standard DOS DIR of GIF files, but with height, width, and colors');π{ writeln; }π writeln(' Output looks like this (with no parameters):');π{ writeln; }π writeln(' GIFNAME GIF 178152 5-11-91 640h 400w 256c');π writeln;π { writeln('Enter *.* to display all files (normal Dir).'); }π writeln(' Parameters:');π writeln(' /P Pauses the display, just as in the DOS Dir command.');π writeln(' /A Displays complete information, except time.');π writeln(' /D turns display of the file Date off.');π writeln(' /T turns display of the file Time on.');π writeln(' /M shows size in Megabytes instead of bytes.');π writeln(' /F displays GIFNAME.GIF instead of GIFNAME GIF');π writeln(' /E suppress display of the extension.');π writeln(' /G Check if file optimized by GIFLITE and display it if so.');π writeln(' /V displays the Version of the GIF file - GIF87a, GIF89a, etc.');π writeln(' /C displays "GCM" if the file has a Global Color Map');π writeln(' /R Resolution - displays the total number of colors in the pallette');π writeln(' /H or /? displays this Help screen.');π if Doserror > 0 then writeln;π If Doserror = 18 then Writeln(' File not found');π If Doserror = 3 then writeln(' Path not found');π if Doserror > 0 then writeln;π halt(98);πend;π(************************************************)πProcedure FlipB(Var f : boolean);πBeginπ If f then f := false else f := true;πEnd;π(************************************************)πProcedure ProcessParms(s : string);πvar sr : searchrec;πBeginπ If (pos('/',s) = 1) Thenπ Beginπ If (Copy(s,2,1) = 'P') or (Copy(s,2,1) = 'p') then Pause := true;π If (Copy(s,2,1) = 'D') or (Copy(s,2,1) = 'd') then Flipb(dodate);π If (Copy(s,2,1) = 'T') or (Copy(s,2,1) = 't') then Flipb(dotime);π If (Copy(s,2,1) = 'M') or (Copy(s,2,1) = 'm') then Flipb(domegs);π If (Copy(s,2,1) = 'F') or (Copy(s,2,1) = 'f') then Flipb(dofiledot);π If (Copy(s,2,1) = 'V') or (Copy(s,2,1) = 'v') then Flipb(doversion);π If (Copy(s,2,1) = 'R') or (Copy(s,2,1) = 'r') then Flipb(dopalette);π If (Copy(s,2,1) = 'G') or (Copy(s,2,1) = 'g') then Flipb(dogiflite);π If (Copy(s,2,1) = 'C') or (Copy(s,2,1) = 'c') then Flipb(doGCT);π If (Copy(s,2,1) = 'E') or (Copy(s,2,1) = 'e') then Flipb(doextension);π If (Copy(s,2,1) = 'A') or (Copy(s,2,1) = 'a') thenπ Beginπ Flipb(doall);π dodate := true; dotime := false; dofiledot := false;π domegs := false; doversion := true; dopalette := false;π doGCT := true; doextension := true; dogiflite := true;π End;π If (Copy(s,2,1) = 'H') or (Copy(s,2,1) = 'h') or (Copy(s,2,1) = '?') then Badparms;π Endπ Elseπ Beginπ Path := FExpand(s);π{ If Copy(Path,Length(Path),1) = '\' then Path := Path + '*.GIF'; }π{ If Pos('.',path) = 0 then path := path + '.GIF'; }π{ If Pos('*',Path) + Pos('?',path) + Pos('.GIF',path) = 0π thenπ beginπ FindFirst(Path,$10,sr);π If Doserror = 0 then Path := Path + '\*.gif';π end; }π End;πEnd;π(*******************)πFunction Exponential(A:integer; B:byte):longint;πVar yyy : longint;π(* Returns A to the Bth *)πBeginπ yyy := A;π For count := 2 to B Do yyy := yyy * A;π If b=0 then Exponential := 1 else Exponential := yyy;πEnd;π(**********************************)πFunction BV(A:byte; b:byte):byte; {BitValue}πvar aa : byte;π(* A is the byte value - b is the bit # for which the value is desired 1-8 *)πBeginπ aa := a;π While aa >= Exponential(2,b) do dec(aa,Exponential(2,b));π If aa < Exponential(2,b-1) then BV := 0 else BV := 1;πEnd;π(***********************)πProcedure ClearName;πBeginπ For count := 1 to 12 do DirInfo.name[count] := ' ';πEnd;π(**************************)πProcedure ClearABC;πBeginπ A := ' '; B := ' '; C := ' ';πEnd;π(*******************)π{πProcedure ClearCmt;πBeginπ CmtFound := False;π for count := 1 to MaxCmtSize do Cmt[count] := ' ';πEnd;π}π(*******************)πProcedure WriteName(n : String12);πVar p, q, qq, r : byte;πBeginπ p := 0; q := 0; r := 0;π If doextension then qq :=12 else qq := 8;π While r < length(n) DOπ Beginπ inc(p);π inc(r);π if (n[p] = '.') and not dofiledotπ thenπ Beginπ If p < 9 then write(' ':9-p);π inc(q, 9-p);π If doextension thenπ Beginπ write(' ');π inc(q);π End;π Endπ elseπ beginπ If (p<9) or doextension thenπ beginπ write(n[p]);π inc(q);π end;π end;π End;π If q < qq then write(' ':qq-q);πEnd;π(********************************)πProcedure WriteDate(i : longint);πVar d : datetime;πBeginπ Unpacktime(i,d);π If d.month > 9 then Write(d.month,'-') else Write('0',d.month,'-');π If d.day > 9 then Write(d.day) else Write('0',d.day);π Write('-',d.year mod 100);π Write(' ');πEnd;π(********************************)πProcedure WriteTime(i : longint);πVar d : datetime;πBeginπ Unpacktime(i,d);π Write(' ');π if d.hour = 0 then Write('12') else if d.hour mod 12 > 9 then Write(d.hour mod 12) else write(' ',d.hour mod 12);π if d.min = 0 then Write(':00') else if d.min > 9 then write(':',d.min) else Write(':0',d.min);π If d.hour > 11 then Write('p ') else Write('a ');πEnd;π(*****************************************************)πProcedure Writeline(s : Searchrec);πVar xx : byte; ss: string[1];πBeginπ Writename(s.name);π If domegs or doextension thenπ Beginπ xx := (s.size+5120) div 10240;π If xx < 10π thenπ beginπ Str(xx:1, ss);π meg := '0' + ssπ endπ elseπ Str(xx:2, meg)π End;π If domegs then Write(' .',meg,' ') else Write(s.size:10);π Write(' ');π If dodate then Writedate(s.time);π If dotime then WriteTime(s.time);π If isgif thenπ Beginπ Write(height:4,'h',width:4,'w',colors:4,'c ');π If dopalette then Write(sizeofpalette,'R ');π If doversion then Write (' ',gversion,' ');π If doGCT then begin if GCTF then Write(' GCM ') else write(' ') end;π If doGIFLITE then begin if GIFLITE then Write(' GL ') else write(' ng ') end;π End;π Writeln;πEnd;π(****************************************************)πProcedure ProcessGifFile;πVar result : word;πBEGINπ Assign(GifFile, Concat(Dir,DirInfo.name));π Reset(GifFile, 1);π isgif := false;π inc(filecount);π inc(totalsize,dirinfo.size);π ClearABC;π(* See if it's a GIF file. *)π Result := Pos('.',Dirinfo.name);π If (result > 0) andπ (Copy(DirInfo.name,result,Length(DirInfo.name)-result+1) = '.GIF')π then isgif := true;π{ Result := Filesize; }π If isgif { and (result>12) }π thenπ Beginπ blockread(GifFile, A, 1, result);π blockread(GifFile, B, 1, result);π blockread(GifFile, C, 1, result);π gheader := A + B + C;π End;π If gheader = 'GIF'π Thenπ Begin {GifFileFound!}π blockread(GifFile, A, 1, result);π blockread(GifFile, B, 1, result);π blockread(GifFile, C, 1, result);π gversion := A + B + C;π blockread(GifFile, height, 2, result);π blockread(GifFile, width, 2, result);π blockread(GifFile, Abyte, 1, result);π SizeOfGCT := BV(Abyte,1) + BV(Abyte,2)*2 + BV(Abyte,3)*4 +1;π colors := Exponential(2,SizeOfGCT);π If BV(Abyte,4) = 1 then SortFlag := true else SortFlag := false;π ColorResolution := BV(Abyte,5) + BV(Abyte,6)*2 + BV(Abyte,7)*4 +1;π SizeOfPalette := Exponential(2,ColorResolution);π SizeOfPalette := Exponential(SizeofPalette,3);π If BV(Abyte,8) = 1 then GCTF := true else GCTF := false;π Blockread(GifFile, BackgroundColorIndex, 1);π Blockread(GifFile, PixelAspectRatio, 1);π If dogifliteπ thenπ Beginπ giflite := false;π icount := 0;π count := 1;π jcount := giflitesearch;π If GCTF then inc(jcount,3*colors);π While (icount < jcount) and not giflite doπ Beginπ Blockread(Giffile, A, 1, result);π If A = Copy(gifliteheader, count, 1) thenπ Beginπ If count = length(gifliteheader)π thenπ giflite := trueπ elseπ inc(count)π End;π Inc(icount);π End;π End;π End;π Writeline(DirInfo);π Close(GifFile);π Inc(LinesWritten);πEND;π(**********************)πProcedure WriteVolLabel;πVar v : searchrec; c : byte;πBeginπ FindFirst(Copy(Path,1,3)+'*.*',VolumeID,v);π Write(' Volume in drive ',Copy(Path,1,1),' is ');π For c := 1 to length(v.name) do if v.name[c] <> '.' then write(v.name[c]);π Writeln;π Write(' Directory of ',Copy(Dir,1,Length(Dir)-1));π If Copy(Dir,2,1) = ':' then Write('\');π Writeln;π Writeln;πEnd;π(***************************************)πProcedure ParseParms(pps : string);πBegin { This only gets parms with a slash / in them. }πIf Pos('/',pps) <> 1 Then { This is the filename with a slash appended }π Beginπ{ ProcessParms(Copy(pps,1,Pos('/',pps)-1)); }π Path := Fexpand(Copy(pps,1,Pos('/',pps)-1));π pps := Copy(pps,Pos('/',pps),Length(pps)-Pos('/',pps)+1)π End;πWhile (Pos('/',pps) > 0) and (Length(pps) > 1) Doπ Beginπ ProcessParms(Copy(pps,1,2));π pps := Copy(pps,2,Length(pps)-1);π If Pos('/',pps) > 0 thenπ pps := Copy(pps,Pos('/',pps),Length(pps)-Pos('/',pps)+1);π End;πEnd;π(***************************************)πProcedure Initialize;πVar sr : searchrec;πBeginπ Assign(Input,''); Reset(Input);π Assign(Output,''); Rewrite(Output);π Writeln;π Writeln(ProSoft);π Writeln;π dodate := true; dotime := false; domegs := false; doextension := true;π dopalette := false; doGCT := false; doversion := false; pause := false;π dofiledot := false; dogiflite := true; doall := false;π gheader := ' '; gversion := ' ';π ClearABC; Clearname;π FileCount := 0; TotalSize := 0; LinesWritten := 0;π For count := 1 to Sizeof(path) do Path[count] := ' ';π For count := 1 to Sizeof(Dir) do Dir[count] := ' ';π For Count := 1 to Sizeof(Name) do Name[count] := ' ';π For count := 1 to Sizeof(Ext) do Ext[count] := ' ';π If paramcount = 0π thenπ Path := FExpand('*.GIF')π elseπ If Pos('/',paramstr(1)) = 1 then path := FExpand('*.GIF');π For Count := 1 to paramcount do If Pos('/',paramstr(count)) > 0π thenπ ParseParms(paramstr(count))π elseπ Path := Fexpand(paramstr(count));π{π FindFirst(Path,$10,sr);π If (Doserror = 0) and (sr.attr = $10) thenπ beginπ Path := Path + '\*.gif';π Path := FExpand(Path)π end;π}π Fsplit(Path,Dir,Name,Ext);π If (name = '') or (name = ' ') then name := '*';π If (Ext = '') or (Ext = ' ') then Ext := '.GIF';π Path := Dir + Name + Ext;πEnd;π(******************> Main <*********************)πBegin { Main }π Initialize;π FindFirst(Path,$21,DirInfo);π If Doserror = 0π thenπ Beginπ WriteVolLabel;π While DosError < 1 doπ Beginπ If (dirinfo.name = '.') or (dirinfo.name = '..')π thenπ For count := 1 to 12 do DirInfo.name[count] := ' 'π elseπ ProcessGifFile;π FindNext(DirInfo);π If pause and (LinesWritten = ScreenLines) and (DosError < 1)π thenπ Beginπ Writeln('Press any key to continue . . .');π AssignCrt(Input); Reset(Input);π AssignCrt(Output); Rewrite(Output);π ch := Readkey;π Assign(Input,''); Reset(Input);π Assign(Output,''); Rewrite(Output);π Writeln;π LinesWritten := 1;π End;π End;π Write(FileCount:9,' file');π If Filecount = 1 then Write(' ') else Write('s ');π cs := Copy(Path,1,1);π cc := cs[1];π count := ord(cc)-64;π Writeln(totalsize:12,' bytes');π Writeln(' ':16,diskfree(count):12,' bytes free ');π Writeln;π Endπ Elseπ Badparms;πEnd.π 4 08-25-9409:06ALL NEIL GORIN Create Directories SWAG9408 α<└ 23 ª╢ (*πRF> Has anyone written a function for creating a pathname ?πRF> I'm having a problem with putting together a function that youπRF> can pass a pathname to, such as: C:\WINDOWS\SYSTEM\STUFFπRF> and have it create the path if it's at all possible.ππTry the following, taken from a couple (one DOS, one Windows) ofπinstall programs I am working on. Lines beginning {} shouldπbe replaced with your preferred error reporting methods (theyπcurrently use my UNIXGUI package). This is not guaranteed toπtrap all possible errors.ππLEGALDIR will return true if the path is legal. You *must* specifyπthe drive in the path as in C:\WINDOWS\SYSTEM\STUFFπ*)πFunction LegalDir(path:string):boolean;π var flag:boolean;π beginπ path:=short(path);π flag:=true;π if path[1]<'A' then flag:=false;π if path[1]>'Z' then flag:=false;π if path[2]<>':' then flag:=false;π if path[3]<>'\' then flag:=false;π delete(path,1,3);π While path<>'' doπ beginπ if pos('\',path)>9 then flag:=false;π if ((length(path)>1) and (path[1]='\') and (path[2]='\'))π then flag:=false;π if path[1]=' ' then flag:=false;π if not (path[1] inπ ['A','B','C','D','E','F','G','H','I','J','K','L','M',π 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z',π '1','2','3','4','5','6','7','8','9','0','_','^','$',π '~','!','#','%','&','-','{','}','(',')','\'])π then flag:=false;ππ delete(path,1,1);π end;π if not flag thenπ beginπ{} WinOkDialogue('Cannot Install',π 'Illegal Directory name!',π 'Please re-edit and',π 'try again.');π end;π LegalDir:=flag;π end;π{πMAKEDIRECTORY will make the directory structure you pass to it. Bestπto call LEGALDIR first, for obvious reasons.π}π Procedure MakeDirectory(st:string);π var ns:string;π ior:word;π beginπ Chdir(st);π if ioresult=0 then exit;π MKDIR(st);π ior:=ioresult;π if ior=3 thenπ beginπ ns:=st;π while ns[length(ns)]<>'\' do delete(ns,length(ns),1);π delete(ns,length(ns),1);π MakeDirectory(ns);π MakeDirectory(st);π end;π if ((ior<>0) and (ior<>3)) thenπ beginπ{} Popdialogue;π{} WinOkDialogue('Error',π 'Illegal Directory',π 'or drive error!',π 'Halting...');π{} closegui;π halt;π end;π end;π 5 08-25-9409:07ALL JOSE CAMPIONE ExistDir SWAG9408 '£åY 27 ª╢ (*ππ Here are three functions that I wrote to detect directories. The first π one uses findfirst, the second uses chdir and the third uses getfattr.π According to my benchmarkings the third one is the fastest (and the one π I preffer) . All of them need the DOS unit and will do the job as π requested, however, they are not exactly equivalent: The first functionπ will return false for d:= '<disk>:\', '\' or '..\'. They all return true π if the drive has been SUBSTituted.ππ Here are the results with some extreme strings (T = true, F = false)...ππ Function ---> 1 2 3 π -----------------------------------π d:= '' F F Fπ d:= '.' T T Tπ d:= '..' F T T (*)π d:= '.\' F F (@) Tπ d:= '..\' F T T (*)π d:= '\' F T Tπ d:= '/' F T (#) F π d:= 'c:\' F T Tπ d:= 'c:\.' F T Tππ (*) while logged in a non-root directory.π (@) chdir('.\') is not recognized as a valid change!π (#) chdir('/') switches to the root!ππ In all other situations the three functions return the same result.π π ---------------[cut]-----------------------------------------------π π function direxist1(d:pathstr): boolean;π varπ dirinfo: searchrec;π len : byte;π beginπ len:= length(d);π if (d[len] = '\') and {if d has a trailing slash and is... }π (len > 3) then {other than "<disk>:\", "..\"... }π dec(d[0]); {remove the trailing slash. }π findfirst(d,directory,dirinfo);{call findfirst. }π direxist1:= doserror = 0; {report boolean result }π end;ππ function direxist2(d:pathstr) : boolean;π varπ curdir: pathstr;π exist : boolean;π len : byte;π beginπ len:= length(d);π if (d[len] = '\') and {if d has a trailing slash and is... }π (len > 3) then {other than "<disk>:\" or "..\"... }π dec(d[0]); {remove the trailing slash. }π getdir(0,curdir); {get current dir }π {$I-} chdir(d); {$I+} {attempt changing directory }π exist := IOResult = 0; {test IOResult }π if exist then chdir(curdir); {if exist then go back to current dir }π direxist2:= (d <> '') and exist;π end;ππ function direxist3(d: pathstr): boolean;π varπ f : file;π attr: word;π len : byte;π beginπ len:= length(d);π if (d[len] = '\') then {if d has a trailing slash... }π dec(d[0]); {remove the trailing slash. }π d:= d + '\.'; {add '\.' to d }π assign(f,d); {assign d to f }π getfattr(f,attr); {get the attribute word }π direxist3 := ((attr and directory)=directory);π {return true if attr is directory }π end;ππ 6 08-25-9409:09ALL GREG VIGNEAULT Create Directories SWAG9408 °┼ 17 ª╢ {π>Has anyone written a function for creating a pathname ?π>I'm having a problem with putting together a function that youπ>can pass a pathname to, such as: C:\WINDOWS\SYSTEM\STUFFπ>and have it create the path if it's at all possible.π>the problem I'm having seems to stem from the fact that 'MKDIR()'π>can only handle making one directory which is under the current one.ππ This is because DOS' MkDir itself will fail if any element of aπ path is missing. You'll need to parse and build the path, goingπ directory by directory.ππ Here's some example code that you may use to create a MakePathπ function...π}ππPROGRAM MakePath; { Create a path. July 21,1994 Greg Vigneault }ππVAR Try, Slash : BYTE;π Error : WORD;π TmpDir, IncDir, NewDir, OurDir : STRING;πBEGINπ WriteLn;ππ NewDir := 'C:\000\111\222'; { an example path to create }ππ GetDir (0,OurDir); { because we'll use CHDIR to confirm directories }π WHILE NewDir[Length(NewDir)] = '\' DO DEC(NewDir[0]); { clip '\' }π IncDir := ''; { start with empty string }π REPEATπ Slash := Pos('\',NewDir); { check for slash }π IF (Slash <> 0) THEN BEGINπ IncDir := IncDir + Copy( NewDir, 1, Slash ); { get directory }π NewDir := Copy( NewDir, Slash+1, Length(NewDir)-Slash ); ENDπ ELSEπ IncDir := IncDir + NewDir;π TmpDir := IncDir;π IF (Length(TmpDir) > 3) THEN { clip any trailing '\' }π WHILE TmpDir[Length(TmpDir)] = '\' DO DEC(TmpDir[0]);π REPEATπ {$I-} ChDir(TmpDir); {$I+} { try to log into the directory... }π Error := IoResult;π IF (Error <> 0) THEN BEGIN { couldn't ChDir, so try MkDir... }π {$I-} MkDir(TmpDir); {$I+}π Error := IoResult;π END;π IF (Error <> 0) THEN INC(Try) ELSE Try := 0;π UNTIL (Error = 0) OR (Try > 3);π IF (Error = 0) THEN WriteLn('"',TmpDir,'" -- okay');π UNTIL (Slash = 0) OR (Error <> 0);ππ IF (Error <> 0) THEN WriteLn('MkDir ',TmpDir,' failed!',#7);ππ ChDir(OurDir); { log back into our starting directory }ππ WriteLn;πEND {MakePath}.π